//
//  LoginAnimationController.m
//  Objc进阶Demo
//
//  Created by Don't update on 2018/7/20.
//  Copyright © 2018年 Don't update. All rights reserved.
//

#import "LoginAnimationController.h"

@interface LoginAnimationController ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *face;
@property (weak, nonatomic) IBOutlet UIImageView *handsLeftDown;
@property (weak, nonatomic) IBOutlet UIImageView *handsRightDowm;
@property (weak, nonatomic) IBOutlet UIImageView *eyes;
@property (weak, nonatomic) IBOutlet UIImageView *handsLeftUp;
@property (weak, nonatomic) IBOutlet UIImageView *handsRightUp;
@property (weak, nonatomic) IBOutlet UITextField *account;
@property (weak, nonatomic) IBOutlet UITextField *password;

@end

@implementation LoginAnimationController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.eyes.alpha = 0;
    self.password.delegate = self;
    self.account.delegate = self;
    
}


-(void)textFieldDidBeginEditing:(UITextField *)textField{
    //闭眼
    if ([textField isEqual:_password]) {
        [UIView animateWithDuration:0.8 animations:^{
            self.eyes.alpha = 1;
             self.handsLeftUp.frame = CGRectMake(127, 61, 44, 37);
            
            self.handsRightUp.frame =  CGRectMake(190, 66, 54, 37);
        }];
    }
    //睁眼
    if ([textField isEqual:_account]) {
        [UIView animateWithDuration:0.8 animations:^{
            self.eyes.alpha = 0;
        }];
    }
}



@end
